<script setup lang="ts">
import {defineProps, onMounted, ref, watch} from "vue"
import {Get, SetKVT} from "../../wailsjs/go/dbservice/DbConfigService";
import {ConfigTypeDefault} from "../constant/config_types";

const props=defineProps({
  ConfigKey:{
    type:String,
    default:""
  },
  Label:{
    type:String,
    default:"请输入"
  },
  ConfigType:{
    type:String,
    default:ConfigTypeDefault
  },
})
onMounted(async  ()=>{
  CurrInputValue.value=await Get(props.ConfigKey)
})

let CurrInputValue=ref("")
watch(CurrInputValue,(nval:string,oval:string)=>{
    SetKVT(props.ConfigKey,nval,props.ConfigType)
})


</script>


<template>
  <div class="mt-2 items-end text-right" >
    <q-input outlined v-model="CurrInputValue" :label="props.Label" />
  </div>
</template>

<style scoped>

</style>